package com.home.viewpager2demo

import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import androidx.fragment.app.Fragment
import androidx.viewpager2.widget.ViewPager2

class MainActivity : AppCompatActivity() {
  override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)
    setContentView(R.layout.activity_main)
    var vp2 = findViewById<ViewPager2>(R.id.vp2)
    val mFragments: MutableList<Fragment> = ArrayList()
    mFragments.add(OneFragment())
    mFragments.add(TwoFragment())
    mFragments.add(ThreeFragment())
    var adapter = MyFragmentStateAdapter(this,mFragments)
    vp2.adapter = adapter
    vp2.isUserInputEnabled = false
  }
}